package cn.ffcs.uec.post.component;

import org.zkoss.zk.ui.Components;
import org.zkoss.zk.ui.IdSpace;
import org.zkoss.zul.Tree;

import cn.ffcs.uec.post.vo.BasePostVo;
import cn.ffcs.uom.common.zkplus.zul.tree.model.BaseTreeModel;
import cn.ffcs.uom.common.zkplus.zul.tree.node.impl.TreeNodeImpl;
import cn.ffcs.uom.common.zkplus.zul.tree.render.BaseTreeitemRenderer;

public class BasePostTree extends Tree implements IdSpace {
	private static final long serialVersionUID = 163236320248420251L;
	
	public BasePostTree() {
		Components.wireVariables(this, this);
		Components.addForwards(this, this, '$');
	}
	
	/**
	 * 创建
	 */
	public void onCreate() {
		this.setSclass("zt-tree-scroll");
		bindTree();
	}
	
	/**
	 * 绑定树
	 */
	@SuppressWarnings("deprecation")
	public void bindTree() {
		BasePostVo basePostVo = new BasePostVo();
		basePostVo.setIsRoot(true);
		final TreeNodeImpl<BasePostVo> treeNode = new TreeNodeImpl<BasePostVo>(
				basePostVo);
		treeNode.readChildren();
		this.setModel(new BaseTreeModel(treeNode));
		this.setTreeitemRenderer(new BaseTreeitemRenderer());
	}
}
